﻿using Super_Management_Mayhem.Content.Spritesheet.Player;
using Transformable_Engine_v2.Engine.Animation.FrameAnimation;
using Transformable_Engine_v2.Engine.Graphics;

namespace Super_Management_Mayhem.Content.Animations.Manager
{
    public class Spin : FrameAnimationDescription
    {
        public Spin(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.IdleState.Left), 3));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.IdleState.Up), 0));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.IdleState.Right), 1));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.IdleState.Down), 2));
            FrameRate = 10;
        }
    }

    public class Ghost : FrameAnimationDescription
    {
        public Ghost(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.Ghost.Ghost0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.Ghost.Ghost1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.Ghost.Ghost2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.Ghost.Ghost3), 0));
            FrameRate = 10;
        }
    }

    public class Fall : FrameAnimationDescription
    {
        public Fall(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.FallState.Fall0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.FallState.Fall1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.FallState.Fall2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.FallState.Fall3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.FallState.Fall4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.FallState.Fall5), 6));
            AddFrame(6, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.FallState.Fall6), 7));
            AddFrame(7, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.FallState.End), 8) { IsLastFrame = true });
            FrameRate = 7;
        }
    }

    #region Death animation
    public class DeathLeft : FrameAnimationDescription
    {
        public DeathLeft(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitLeftState.Hurt), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitLeftState.Die1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitLeftState.Die2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitLeftState.Die3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitLeftState.Die4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitLeftState.Die5), 6));
            AddFrame(6, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitLeftState.Die6), 7) { IsLastFrame = true });
            FrameRate = 12;

            Frames[0].Duration = 250;
        }
    }
    public class DeathRight : FrameAnimationDescription
    {
        public DeathRight(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitRightState.Hurt), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitRightState.Die1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitRightState.Die2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitRightState.Die3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitRightState.Die4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitRightState.Die5), 6));
            AddFrame(6, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.HitRightState.Die6), 7) { IsLastFrame = true });
            FrameRate = 12;

            Frames[0].Duration = 250;
        }
    }
    #endregion

    #region Walk animations

    public class WalkDown : FrameAnimationDescription
    {
        public WalkDown(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownState.Walk0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownState.Walk1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownState.Walk2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownState.Walk3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownState.Walk4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownState.Walk5), 0));
            FrameRate = 10;
        }
    }

    public class WalkRight : FrameAnimationDescription
    {
        public WalkRight(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightState.Walk0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightState.Walk1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightState.Walk2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightState.Walk3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightState.Walk4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightState.Walk5), 0));
            FrameRate = 10;
        }
    }

    public class WalkUp : FrameAnimationDescription
    {
        public WalkUp(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpState.Walk0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpState.Walk1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpState.Walk2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpState.Walk3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpState.Walk4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpState.Walk5), 0));
            FrameRate = 10;
        }
    }

    public class WalkLeft : FrameAnimationDescription
    {
        public WalkLeft(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftState.Walk0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftState.Walk1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftState.Walk2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftState.Walk3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftState.Walk4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftState.Walk5), 0));
            FrameRate = 10;
        }
    }

    public class WalkDownCarry : FrameAnimationDescription
    {
        public WalkDownCarry(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownCarryState.Walk0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownCarryState.Walk1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownCarryState.Walk2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownCarryState.Walk3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownCarryState.Walk4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkDownCarryState.Walk5), 0));
            FrameRate = 10;
        }
    }

    public class WalkRightCarry : FrameAnimationDescription
    {
        public WalkRightCarry(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightCarryState.Walk0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightCarryState.Walk1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightCarryState.Walk2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightCarryState.Walk3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightCarryState.Walk4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkRightCarryState.Walk5), 0));
            FrameRate = 10;
        }
    }

    public class WalkUpCarry : FrameAnimationDescription
    {
        public WalkUpCarry(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpCarryState.Walk0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpCarryState.Walk1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpCarryState.Walk2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpCarryState.Walk3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpCarryState.Walk4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkUpCarryState.Walk5), 0));
            FrameRate = 10;
        }
    }

    public class WalkLeftCarry : FrameAnimationDescription
    {
        public WalkLeftCarry(string spriteSheetPath)
        {
            IsLooping = true;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftCarryState.Walk0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftCarryState.Walk1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftCarryState.Walk2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftCarryState.Walk3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftCarryState.Walk4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.WalkLeftCarryState.Walk5), 0));
            FrameRate = 10;
        }
    }

    #endregion

    #region Attack animations

    public class AttackDownState : FrameAnimationDescription
    {
        public static int Duration
        {
            get
            {
                return (int) (1000.0f / Framerate * 5);
            }
        }

        public static int Framerate
        {
            get
            {
                return 31;
            }
        }

        public AttackDownState(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackDownState.Attack0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackDownState.Attack1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackDownState.Attack2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackDownState.Attack3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackDownState.Attack4), 5) { IsLastFrame = true });
            FrameRate = Framerate;
        }
    }

    public class AttackUpState : FrameAnimationDescription
    {
        public static int Duration
        {
            get
            {
                return (int) (1000.0f / Framerate * 6);
            }
        }

        public static int Framerate
        {
            get
            {
                return 37;
            }
        }

        public AttackUpState(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackUpState.Attack0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackUpState.Attack1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackUpState.Attack2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackUpState.Attack3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackUpState.Attack4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackUpState.Attack5), 6) { IsLastFrame = true });
            FrameRate = Framerate;
        }
    }

    public class AttackRightState : FrameAnimationDescription
    {
        public static int Duration
        {
            get
            {
                return (int) (1000.0f / Framerate * 6);
            }
        }

        public static int Framerate
        {
            get
            {
                return 37;
            }
        }

        public AttackRightState(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackRightState.Attack0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackRightState.Attack1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackRightState.Attack2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackRightState.Attack3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackRightState.Attack4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackRightState.Attack5), 6) { IsLastFrame = true });
            FrameRate = Framerate;
        }
    }

    public class AttackLeftState : FrameAnimationDescription
    {
        public static int Duration
        {
            get
            {
                return (int) (1000.0f / Framerate * 6);
            }
        }

        public static int Framerate
        {
            get
            {
                return 37;
            }
        }

        public AttackLeftState(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackLeftState.Attack0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackLeftState.Attack1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackLeftState.Attack2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackLeftState.Attack3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackLeftState.Attack4), 5));
            AddFrame(5, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.AttackLeftState.Attack5), 6) { IsLastFrame = true });
            FrameRate = Framerate;
        }
    }

    #endregion

    #region PickupAnimations

    public class PickupLeft : FrameAnimationDescription
    {
        public static double AnimationTime
        {
            get
            {
                return 5 * 1000.0 / 15;
            }
        }

        public PickupLeft(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupLeftState.Pickup0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupLeftState.Pickup1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupLeftState.Pickup2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupLeftState.Pickup3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupLeftState.PickupLeft), 0) { IsLastFrame = true });
            FrameRate = 15;
        }
    }

    public class PickupRight : FrameAnimationDescription
    {
        public static double AnimationTime
        {
            get
            {
                return 5 * 1000.0 / 15;
            }
        }

        public PickupRight(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupRightState.Pickup0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupRightState.Pickup1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupRightState.Pickup2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupRightState.Pickup3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupRightState.PickupRight), 0) { IsLastFrame = true });
            FrameRate = 15;
        }
    }

    public class PickupUp : FrameAnimationDescription
    {
        public static double AnimationTime
        {
            get
            {
                return 5 * 1000.0 / 15;
            }
        }

        public PickupUp(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupUpState.Pickup0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupUpState.Pickup1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupUpState.Pickup2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupUpState.Pickup3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupUpState.PickupUp), 0) { IsLastFrame = true });
            FrameRate = 15;
        }
    }

    public class PickupDown : FrameAnimationDescription
    {
        public static double AnimationTime
        {
            get
            {
                return 5 * 1000.0 / 15;
            }
        }

        public PickupDown(string spriteSheetPath)
        {
            IsLooping = false;
            AddFrame(0, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupDownState.Pickup0), 1));
            AddFrame(1, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupDownState.Pickup1), 2));
            AddFrame(2, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupDownState.Pickup2), 3));
            AddFrame(3, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupDownState.Pickup3), 4));
            AddFrame(4, new FrameDescription(SpriteSheet.GetSprite(spriteSheetPath, ManagerSheet.PickupDownState.PickupDown), 0) { IsLastFrame = true });
            FrameRate = 15;
        }
    }

    #endregion
}
